﻿using System;
using UnityEngine;
using XUpdater;

namespace XUtliPoolLib
{
	// Token: 0x0200004A RID: 74
	public abstract class AssetBundleLoader
	{
		// Token: 0x06000253 RID: 595 RVA: 0x00003284 File Offset: 0x00001484
		public virtual void Load()
		{
		}

		// Token: 0x06000254 RID: 596 RVA: 0x00003284 File Offset: 0x00001484
		public virtual void LoadImm()
		{
		}

		// Token: 0x06000255 RID: 597 RVA: 0x00003284 File Offset: 0x00001484
		public virtual void LoadBundle()
		{
		}

		// Token: 0x06000256 RID: 598 RVA: 0x00003284 File Offset: 0x00001484
		public virtual void LoadBundleImm()
		{
		}

		// Token: 0x17000061 RID: 97
		// (get) Token: 0x06000257 RID: 599 RVA: 0x00012FDC File Offset: 0x000111DC
		public virtual bool isComplete
		{
			get
			{
				return this.state == LoadState.State_Error || this.state == LoadState.State_Complete;
			}
		}

		// Token: 0x06000258 RID: 600 RVA: 0x00013004 File Offset: 0x00011204
		protected virtual void Complete()
		{
			if (this.onComplete != null)
			{
				AssetBundleManager.LoadAssetCompleteHandler loadAssetCompleteHandler = this.onComplete;
				this.onComplete = null;
				loadAssetCompleteHandler(this.bundleInfo, this.loadHandlerID);
			}
			this.bundleManager.LoadComplete(this);
		}

		// Token: 0x06000259 RID: 601 RVA: 0x00013050 File Offset: 0x00011250
		protected virtual void Error()
		{
			if (this.onComplete != null)
			{
				AssetBundleManager.LoadAssetCompleteHandler loadAssetCompleteHandler = this.onComplete;
				this.onComplete = null;
				loadAssetCompleteHandler(this.bundleInfo, this.loadHandlerID);
			}
			this.bundleManager.LoadError(this);
		}

		// Token: 0x0600025A RID: 602 RVA: 0x0001309C File Offset: 0x0001129C
		protected bool UnloadNotLoadingBundle(AssetBundle bundle)
		{
			bool result;
			if (bundle == null)
			{
				int bundleCount = XSingleton<XUpdater.XUpdater>.singleton.ABManager.BundleCount;
				XSingleton<XUpdater.XUpdater>.singleton.ABManager.UnloadNotUsedLoader();
				Resources.UnloadUnusedAssets();
				XSingleton<XDebug>.singleton.AddErrorLog("AssetBundle Count: ", bundleCount.ToString(), " , ", XSingleton<XUpdater.XUpdater>.singleton.ABManager.BundleCount.ToString(), null, null);
				result = true;
			}
			else
			{
				result = false;
			}
			return result;
		}

		// Token: 0x04000226 RID: 550
		internal AssetBundleManager.LoadAssetCompleteHandler onComplete;

		// Token: 0x04000227 RID: 551
		public int loadHandlerID;

		// Token: 0x04000228 RID: 552
		public uint bundleName;

		// Token: 0x04000229 RID: 553
		public AssetBundleData bundleData;

		// Token: 0x0400022A RID: 554
		public AssetBundleInfo bundleInfo;

		// Token: 0x0400022B RID: 555
		public AssetBundleManager bundleManager;

		// Token: 0x0400022C RID: 556
		public LoadState state = LoadState.State_None;

		// Token: 0x0400022D RID: 557
		protected AssetBundleLoader[] depLoaders;
	}
}
